package modell;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.Timer;

public class Urverk implements ActionListener {

	private Timer timer;
	private Viser viser;
	
	public Urverk(Viser viser){
		this.viser = viser;
		timer = new Timer(ViserKontroller.REFERSH_TIME*20, this);
	}
	
	public void start(){
		if (!timer.isRunning())
			timer.start();
	}
	
	public void stopp(){
		timer.stop();
	}
	
	public boolean kjorer(){
		return timer.isRunning();
	}
	
	private void tellOpp(){
		viser.tellOpp();
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		tellOpp();
	}

}
